﻿@model IEnumerable<CloudFranceTriple.Models.NewsSet>

@{
    ViewBag.Title = CloudFranceTriple.WebRole.Properties.Resources.NewsIndexTitle;
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="content-padding">
    <h1>@CloudFranceTriple.WebRole.Properties.Resources.NewsIndexTitle</h1>
    <section>
        @if (User.IsInRole("RoleAdminNews"))
        {                
            <p>
                @Html.ActionLink(CloudFranceTriple.WebRole.Properties.Resources.ButtonCreate, "Create", "News", new { area = "Portail" }, null)
            </p>
        }
        <table>
            <tr>
                <th>
                    @CloudFranceTriple.WebRole.Properties.Resources.NewsTitle
                </th>
                <th>
                    @CloudFranceTriple.WebRole.Properties.Resources.NewsAuthor
                </th>
                <th>
                    @CloudFranceTriple.WebRole.Properties.Resources.NewsDateBegin
                </th>
                <th>
                    @CloudFranceTriple.WebRole.Properties.Resources.NewsDateEnd
                </th>
                <th></th>
            </tr>
            @foreach (var item in Model)
            {
                <tr>
                    <td>
                        @Html.ActionLink(item.Title, "Details", "News", new { area = "Portail", id = item.Id }, null)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Author)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.DateBegin, "TemplateUserDate")
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.DateEnd, "TemplateUserDate")
                    </td>
                    <td>                        
                        @if (User.IsInRole("RoleAdminNews"))
                        {
                            <span>
                                @Html.ActionLink(CloudFranceTriple.WebRole.Properties.Resources.ButtonEdit, "Edit", "News", new { area = "Portail", id = item.Id }, null)
                                @Html.ActionLink(CloudFranceTriple.WebRole.Properties.Resources.ButtonDelete, "Delete", "News", new { area = "Portail", id = item.Id }, null)
                            </span>
                        }
                    </td>
                </tr>
            }
        </table>
        <br />
    </section>
</div>
